package service

import (
	"shop/dao"
	"shop/entity"
)

func GetShopById(shopId int) *entity.Shop {
	shop := &entity.Shop{}
	dao.GetDB().Model(&shop).Where("id", shopId).Take(&shop)
	return shop
}

func GetShopByWxPayMchId(wxPayMchId int) *entity.Shop {
	shop := &entity.Shop{}
	dao.GetDB().Model(&shop).Where("wx_pay_mch_id", wxPayMchId).Take(&shop)
	return shop
}

func GetShopInfo(shopId int) *entity.Shop {
	shopInfo := &entity.Shop{}
	dao.GetDB().Model(&shopInfo).
		Select("id", "name", "packing_price", "sending_price", "seeding_need_price", "start_time", "end_time",
			"relation_phones", "relation_qq", "relation_weixin", "status", "notice", "address", "description").
		Where("id", shopId).Take(&shopInfo)
	return shopInfo
}
